package cn.myfirefly.moming.portal.dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import cn.myfirefly.moming.portal.entity.MMUserBackground;
import cn.myfirefly.core.BaseDao;

@Repository
public class UserBackgroundDao extends BaseDao<MMUserBackground> {
	
	public MMUserBackground getBackgroundPicByUserSn(Integer userSn) {
		Session session = getCurrentSession();
		Query query = session.createQuery(" from MMUserBackground where userSn = ? ");
		query.setParameter(0, userSn);
		@SuppressWarnings("rawtypes")
		List list = query.list();
		if(list != null && list.size() > 0){
			return (MMUserBackground) list.get(0);
		}
		return null;
	}
	
}
